/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.liquidByte.trafficMustang.server.dataModel;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Alexandre
 */
@Entity
@Table(name = "aval")
public class Avaliacao implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "AVAL_ID")
    private Long avalId;
    @Size(max = 200)
    @Column(name = "AVAL_DSC")
    private String avalDsc;
    @JoinColumn(name = "USR_ID_AVLR", referencedColumnName = "USR_ID")
    @ManyToOne(optional = false)
    private Usuario usrIdAvlr;
    @JoinColumn(name = "USR_ID_AVLD", referencedColumnName = "USR_ID")
    @ManyToOne(optional = false)
    private Usuario usrIdAvld;
    @JoinColumn(name = "TREC_ID", referencedColumnName = "TREC_ID")
    @ManyToOne(optional = false)
    private Trecho trecId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "AVAL_QLF")
    private int avalQlf;
    @Basic(optional = false)
    @NotNull
    @Column(name = "AVAL_PEND")
    private boolean avalPend;

    public Avaliacao() {
    }

    public Avaliacao(Long avalId) {
        this.avalId = avalId;
    }

    public Long getAvalId() {
        return avalId;
    }

    public void setAvalId(Long avalId) {
        this.avalId = avalId;
    }

    public String getAvalDsc() {
        return avalDsc;
    }

    public void setAvalDsc(String avalDsc) {
        this.avalDsc = avalDsc;
    }

    public Usuario getUsrIdAvlr() {
        return usrIdAvlr;
    }

    public void setUsrIdAvlr(Usuario usrIdAvlr) {
        this.usrIdAvlr = usrIdAvlr;
    }

    public Usuario getUsrIdAvld() {
        return usrIdAvld;
    }

    public void setUsrIdAvld(Usuario usrIdAvld) {
        this.usrIdAvld = usrIdAvld;
    }

    public Trecho getTrecId() {
        return trecId;
    }

    public void setTrecId(Trecho trecId) {
        this.trecId = trecId;
    }

    public int getAvalQlf() {
        return avalQlf;
    }

    public void setAvalQlf(int avalQlf) {
        this.avalQlf = avalQlf;
    }

    public boolean isAvalPend() {
        return avalPend;
    }

    public void setAvalPend(boolean avalPend) {
        this.avalPend = avalPend;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (avalId != null ? avalId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Avaliacao)) {
            return false;
        }
        Avaliacao other = (Avaliacao) object;
        if ((this.avalId == null && other.avalId != null) || (this.avalId != null && !this.avalId.equals(other.avalId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.liquidByte.trafficMustang.server.dataModel.Avaliacao[ avalId=" + avalId + " ]";
    }
    
}
